import http from "@/utils/http";
import {GW} from "@/common/const";
/**
 * 两市交易总量
 * @param {Object} option
 * @param {Number} option.marketType - all-全市场,sh-沪市,sz-深市
 * @return {Promise} Array
 */
export function getChartList(option) {
  const url = `${GW}/gw/ynstockinfo/client/margin/history/chart`;
  const params = {
    marketType: "all",
    ...option,
  };
  return http.get(url, params );
}

/**
 * 两市交易总量分页
 * @param {Object} option - 参数注释
 * @param {String} option.marketType - 缺省默认all-全市场,sh-沪市,sz-深市
 * @param {String} option.field - 缺省默认dim_date
 * @param {String} option.sort - 缺省默认desc,asc-升序,desc-降序
 * @param {String} option.pageNo - 页码默认1
 * @param {String} option.pageSize - 每页条数默认30
 * @return {Promise} Array
 */
export function getChatPage(option) {
  const url = `${GW}/gw/ynstockinfo/client/margin/history/page`;
  const params = {
    marketType: "all",
    field: "dim_date",
    sort: "desc",
    pageNo: 1,
    pageSize: 10,
    ...option,
  };
  return http.get(url,  params );
}

/**
 * 两市交易明细
 * @param {Object} option - 参数注释
 * @param {String} option.marketType - 缺省默认all-全市场,sh-沪市,sz-深市,kcb-科创板
 * @param {String} option.field - 缺省默认rzjme-当日净买入
 * @param {String} option.sort - 缺省默认desc,asc-升序,desc-降序
 * @param {String} option.pageNo - 页码默认1
 * @param {String} option.pageSize - 每页条数默认30
 * @return {Promise} Array
 */
export function getStock(option) {
  const url = `${GW}/gw/ynstockinfo/client/margin/stock/page`;
  const params = {
    marketType: "all",
    field: "rzjme",
    sort: "desc",
    pageNo: 1,
    pageSize: 30,
    ...option,
  };
  return http.get(url, params );
}
